{% extends 'myadmin/index.html' %}

{% block title %}
<title>后台权限组列表</title>
{% endblock %}


{% block cont %}
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title  am-cf">权限组列表</div>

                </div>
                <div class="widget-body  am-fr">

                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <a href="{% url 'myadmin_authgroup_add' %}" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span> 新增</a>
                                </div>
                            </div>
                        </div>
                    </div>
                   


                    <div class="am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>组名</th>
                                    <th>当前组人数</th>
                                    <!-- <th>操作</th> -->
                                </tr>
                            </thead>
                            <tbody>
                            {% for v in groupdata %}
                                <tr>
                                    <td class="am-text-middle">{{ v.id }}</td>
                                    <td class="am-text-middle">{{ v.name }}</td>
                                    <td class="am-text-middle">{{ v.user_set.count }}</td>
                                 
                                    <!-- <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <a href="">
                                                <i class="am-icon-pencil"></i> 删除
                                            </a>
                                        </div>
                                    </td> -->
                                </tr>
                            {% endfor %}
            
                                <!-- more data -->
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">

                        <div class="am-fr">
                            <ul class="am-pagination tpl-pagination">
                               
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $('.select-status').change(function(){
        // 获取当前元素的 值
        var status = $(this).val()
        // 获取当前元素的 id
        var uid = $(this).attr('uid')

        // 发送ajax请求.修改状态
        $.get('{% url 'myadmin_user_set_status' %}',{'uid':uid,'status':status},function(data){
            // 判断当前的返回值
            if(data['code'] == 0){
                alert(data['msg'])
            }
        },'json')
        

    })
</script>
{% endblock %}